package main

import (
	"fmt"
	"math/rand"
	"time"
)

func main() {
	var s string
	name := make([]string, 10, 10)
	name = []string{"A", "B", "C", "D", "E"}
	fmt.Println("====点名系统====")
	for {
        if len(name) == 0 {
			fmt.Println("所有同学都已经回答过问题")
			break
		}
		fmt.Println("请按任意键进行,按q退出....")
		fmt.Scan(&s)
		if s[0] == 'q' {
			fmt.Println("成功退出")
			break
		}
		rand.Seed(time.Now().UnixNano())
		num := rand.Intn(len(name))
		fmt.Printf("请%s回答问题\n", name[num])
        name = append(name[:num], name[num+1:]...)
	}
}
